/**
 * 招聘管理接口
 */
import { stringify } from 'qs';
import request from '@/utils/request';
/**
 * 招聘需求获取工作城市列表
 * @param {*} params
 */
export async function getOrgCity(organizationCode) {
    // return request('/api/org/v1/address/queryOrgAddressListInfo', {
    return request('/api/uc/org/v1/address/queryOrgAddressListInfo', {
        method: 'POST',
        data: {
            organizationCode
        }
    });
}

/**
 * 招聘需求获取机构所在公司的地区
 * @param {string} organizationCode
 */
export async function getOrgArea(organizationCode) {
    return request(`/api/org/v1/queryOrganizationArea/${organizationCode}`, {
        method: 'GET'
    });
}

/**
 * 招聘需求获取职位关键词列表
 */
export async function getPositionTags(tagName) {
    return request('/api/recruitment/v1/position/tag/list', {
        method: 'POST',
        data: {
            tagName,
            showSize: 20
        }
    });
}

/**
 * 招聘需求保存职位关键词
 * @param {*} tagName
 */
export async function savePositionTag(tagName) {
    return request('/api/recruitment/v1/position/tag/save', {
        method: 'POST',
        data: {
            tagName
        }
    });
}

/**
 * 招聘需求批量保存职位关键词
 * @param {*} tagNameList
 */
export async function batchSavePositionTags(tagNameList) {
    return request('/api/recruitment/v1/position/tag/batch_save', {
        method: 'POST',
        data: {
            tagNameList
        }
    });
}

/**
 * 新增招聘需求
 * @param {*} params
 */
export async function saveRecruitment(params) {
    return request('/api/recruitment/v1/workflow/save', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取招聘需求详情
 * @param {string} recruitCode
 */
export async function getRecruitmentInfo(recruitCode) {
    return request(`/api/recruitment/v1/workflow/detail/${recruitCode}`, {
        method: 'GET'
    });
}

/**
 * 变更招聘需求
 * @param {*} params
 */
export async function updateRecruitment(params) {
    return request(`/api/recruitment/v1/workflow/update/${params?.recruitCode}`, {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取招聘需求列表
 * @param {*} params
 */
export async function fetchDemand(params) {
    return request('/api/recruitment/v1/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取招聘需求详情
 * @param {*} params
 */
export async function getDemand(id) {
    return request(`/api/recruitment/v1/detail/${id}`);
}

/**
 * 获取审批信息
 * @param {*} processInstanceId
 */
export function getProcessInfo(processInstanceId) {
    return request(`/api/workflowweb/processinstance/v1/getMyTask/${processInstanceId}`, {
        method: 'GET'
    });
}

/**
 * 一键认领
 * @param {*} params
 */
export async function quickAccept(params) {
    return request('/api/recruitment/v1/oneclickaccept', {
        method: 'POST',
        data: params
    });
}

/**
 * 更新招聘负责人
 * @param {*} params
 */
export async function updateDemandOwner(params) {
    return request('/api/recruitment/v1/updateprincipalemployee', {
        method: 'POST',
        data: params
    });
}

/**
 * 需求认领
 */
export async function recruitClaim(params) {
    return request('/api/recruitment/v1/recruitclaimconfirm', {
        method: 'POST',
        data: params
    });
}

/**
 * 更新招聘需求状态
 * @param {*} params
 */
export async function updateDemandStatus(params) {
    return request('/api/recruitment/v1/updaterecruitstatus', {
        method: 'POST',
        data: params
    });
}

// 加入历史记录
export async function addToHiData(params) {
    return request('/api/oa/workflow/recruitsuite/v1/addRecruitToHiData', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取简历列表
 * @param {object} params
 */
export async function queryResumeList(params) {
    return request('/api/recruitment/v1/resumes/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 简历推荐（赞）
 * @param {number} resumeId 简历Id
 */
export async function setResumeLike(resumeId, comment) {
    return request(`/api/recruitment/v1/resumes/${resumeId}/actions/praise`, {
        method: 'PUT',
        data: { recruitComment: comment }
    });
}

/**
 * 简历不推荐（踩）
 * @param {number} resumeId 简历Id
 */
export async function setResumeDislike(resumeId, comment) {
    return request(`/api/recruitment/v1/resumes/${resumeId}/actions/trample`, {
        method: 'PUT',
        data: { recruitComment: comment }
    });
}

/**
 * 设置简历已读
 * @param {number} resumeId 简历Id
 */
export async function setRead(resumeId) {
    return request(`/api/recruitment/v1/resumes/${resumeId}/actions/read`, {
        method: 'PUT'
    });
}

/**
 * 获取简历详情
 */
export async function getResumesDetail(resumeId) {
    return request(`/api/recruitment/v1/resumes/${resumeId}`, {
        method: 'GET'
    });
}
/**
 * 获取过程状态
 * 返回值： hintType 提示类型 null或0不用提示 1=安排的面试未完成
 */
export async function getProcessStatusByResumeId(resumeId) {
    return request(`/api/recruitment/v1/resumes/process_status/${resumeId}`, {
        method: 'GET'
    });
}

/**
 * 简历解析
 */
export async function analysisResume(params) {
    return request('/api/recruitment/v1/resumes/actions/analysis', {
        method: 'POST',
        data: params
    });
}

/**
 * 录入标准简历
 */
export async function setStandardResumes(params) {
    return request('/api/recruitment/v1/resumes/standard_resumes', {
        method: 'POST',
        data: params
    });
}

/**
 * 简历查重(仅在人才库录入时使用)
 */
export async function checkResumeExists(params) {
    return request('/api/recruitment/v1/talent_archive/duplicate_check', {
        method: 'POST',
        data: params
    });
}

/**
 * 简历查重
 * 调用处：招聘需求-简历-推荐、面试管理-列表-推荐
 * @param params resumeId,talentName,talentEmail,talentPhone
 */
export async function checkResumeDuplicate(params) {
    return request('/api/recruitment/v1/resumes/list/repeat_delivery_resume', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取简历操作记录
 */
export async function queryResumeOperateListById(resumeId) {
    return request(`/api/recruitment/v1/resumes/${resumeId}/resume_operate_records`, {
        method: 'GET'
    });
}

/**
 * 编辑已有简历
 */
export async function editStandardResumes(params) {
    return request(`/api/recruitment/v1/resumes/standard_resumes/${params.id}`, {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取候选人列表
 * @param {object} params
 */
export async function queryCandidateList(params) {
    return request('/api/recruitment/v1/candidates/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取候选人详情
 */
export async function getCandidateDetail(id) {
    return request(`/api/recruitment/v1/candidates/${id}`, {
        method: 'POST'
    });
}

/**
 * 对候选人进行操作
 */
export async function operateForResume(resumeId, operateSaveDTO) {
    return request(`/api/recruitment/v1/candidates/${resumeId}/actions/save_more_operate`, {
        method: 'PUT',
        data: operateSaveDTO
    });
}
/**
 * 查询推荐岗位
 */
export async function queryRecommendPositionList(id, searchText) {
    return request(`/api/recruitment/v1/candidates/${id}/list_recommend_position`, {
        method: 'POST',
        data: { dropDownSearchDTO: { searchText } }
    });
}

/**
 * 通过人才code查询推荐岗位
 */
export async function queryRecommendCodePositionList(talentCode, searchText) {
    return request(`/api/recruitment/v1/candidates/${talentCode}/recommend_position`, {
        method: 'POST',
        data: { dropDownSearchDTO: { searchText } }
    });
}

/**
 * 获取招聘相关统计数据
 * @param {*} recruitCode 需求编号
 */
export async function getCountsByRecruitId(recruitId) {
    return request(`/api/recruitment/v1/num/${recruitId}`, {
        method: 'GET'
    });
}

/**
 * 保存联系面试信息
 * @param {object} params
 */
export async function saveContactInterview(params) {
    return request('/api/recruitment/v1/interviews/actions/save_contact_interview', {
        method: 'POST',
        data: params
    });
}

/**
 * 更新面试安排
 * @param {object} params
 */
export async function updateContactInterview(params) {
    return request(`/api/recruitment/v1/interviews/${params.candidateId}/interview_arranges/${params.contactId}`, {
        method: 'PUT',
        data: params
    });
}

/**
 * 撤销面试
 * @param {object} params
 */
export async function revokeInterview(params) {
    return request(`/api/recruitment/v1/interviews/${params.arrangeId}/actions/revoke`, {
        method: 'POST',
        data: params
    });
}

/**
 * 获取面试安排详情
 * @param {object} params
 */
export async function getInterviewArrangeDetail(params) {
    return request(`/api/recruitment/v1/interviews/${params.candidateId}/interview_arranges/${params.contactId}`, {
        method: 'GET'
    });
}

/**
 * 获取候选人人才简历信息详情
 */
export async function getCandidateInfo(candidateId) {
    return request(`/api/recruitment/v1/candidates/talent/${candidateId}`, {
        method: 'GET'
    });
}

/**
 * 查询候选人修改的面试时间
 */
export async function getModifyTime(contactId) {
    return request(`/api/recruitment/v1/interviews/${contactId}/actions/modify_time`, {
        method: 'GET'
    });
}

/**
 * 获取通知候选人邮件模版
 * @param {*} templateId 模版ID
 * @param {*} contactId 面试安排ID
 */
export async function getInterviewEmailTemplate(templateId, contactId, candidateId) {
    return request('/api/recruitment/v1/interviews/actions/interview_email_notices', {
        method: 'POST',
        data: { templateId, contactId, candidateId }
    });
}

/**
 * 获取通知候选人邮件模版(新!!!)
 * @param {*} templateId 模版ID
 * @param {*} contactId 面试安排ID
 * @param {*} candidateId 候选人ID
 */
export async function getEmailNoticeTemplate(data) {
    return request('/api/recruitment/v1/templates/replace/template', {
        method: 'POST',
        data
    });
}

/**
 * 通知候选人 发送邮件(新!!!)
 */
export async function sendEmailNotice(params) {
    return request('/api/recruitment/v1/templates/actions/send_email', {
        method: 'POST',
        data: params
    });
}

/**
 * 通知背调机构 发送邮件
 */
export async function sendEmailNoticeToThirdParty(params) {
    return request('/api/recruitment/v1/employ/background/actions/org_send_email', {
        method: 'POST',
        data: params
    });
}

/**
 * 录用 发送邮件
 */
export async function sendHireEmail(params) {
    return request('/api/recruitment/v1/employ/resend_employ_email', {
        method: 'POST',
        data: params
    });
}

/**
 * 根据类型获取邮件模板 *
 * @param {*} templateType interview_invitation 面试邀请，interview_elimination 面试淘汰
 * @param {*} contactId 面试安排ID
 */
export async function queryMailTemplateListByType(templateType) {
    return request(`/api/recruitment/v1/templates/bytype/${templateType}`, {
        method: 'GET'
    });
}

/**
 * 发送获选人邮件回调
 * @param {object} params
 */
export async function notifyMsg(params) {
    return request(`/api/recruitment/v1/interviews/${params.contactId}/actions/notify_msg_callback`, {
        method: 'PUT',
        data: params
    });
}

/**
 * 查询单人/多人日程计划列表
 * @param {*} params
 */
export function getScheduleInfos(params) {
    return request('/api/oa/v1/schedule/schedule_infos/multiple_list', {
        method: 'POST',
        data: params
    });
}

/**
 * 查看面试详情列表
 * @param {*} candidateId 候选人ID
 */
export async function queryInterviewDetailList(candidateId) {
    return request(`/api/recruitment/v1/interviews/${candidateId}/interview_arranges`, {
        method: 'GET'
    });
}

/**
 * 候选人注册账号
 * @param {*} params
 */
export function registerAccount(params) {
    return request('/api/oa/v1/work/recruitment/candidates/registerAccount', {
        method: 'POST',
        data: params
    });
}

/**
 * 招聘渠道 修改对外岗位信息
 * @param {*} params
 */
export function setChannelReleases(params) {
    return request('/api/oa/v1/work/recruitment/channel_releases/actions/release', {
        method: 'POST',
        data: params
    });
}

/**
 * 招聘渠道 对外岗位具体信息
 * @param {*} params
 */
export function getRecruitOutwards(recruitId) {
    return request(`/api/recruitment/v1/channel_releases/${recruitId}/recruit_outwards`, {
        method: 'GET'
    });
}

/**
 * 招聘渠道 获取外部渠道列表
 * @param {*} params
 */
export function fetchChannelOutwards(params) {
    return request('/api/recruitment/v1/channel_releases/recruit_outwards/channels', {
        method: 'POST',
        data: params
    });
}

/**
 * 招聘渠道 获取外部渠道记录
 * @param {*} params
 */
export function getRecruitOutwardsChannelRecords(params) {
    return request('/api/recruitment/v1/channel_releases/recruit_outward_channel_records', {
        method: 'POST',
        data: params
    });
}

/**
 * 招聘渠道 获取渠道对外岗位信息
 * @param {*} params
 */
export function getRecruitOutwardsChannelDetail(channelCode, outwardId) {
    return request(
        `/api/recruitment/v1/channel_releases/recruit_outwards/${outwardId}/outward_channels/${channelCode}`,
        {
            method: 'GET'
        }
    );
}

/**
 * 招聘渠道 更新渠道对外岗位信息
 * @param {*} params
 */
export function updateRecruitOutwardsChannelDetail(outwardId, channelCode, jsonStr) {
    return request(`/api/recruitment/v1/channel_releases/recruit_outwards/${outwardId}/outward_channels`, {
        method: 'PUT',
        data: {
            channelCode,
            channelRecruitInfo: jsonStr
        }
    });
}

/**
 * 招聘渠道 获取对猎头渠道岗位信息
 * @param {*} params
 */
export function getRecruitHunterChannelDetail(channelCode, outwardId, infoType) {
    return request(
        `/api/recruitment/v1/channel_releases/recruit_outwards/${outwardId}/hunter_outward_channels/${channelCode}/${infoType}`,
        {
            method: 'GET'
        }
    );
}

/**
 * 招聘渠道 更新对猎头渠道岗位信息
 * @param {*} params
 */
export function updateRecruitHunterChannelDetail(outwardId, data) {
    return request(`/api/recruitment/v1/channel_releases/recruit_outwards/${outwardId}/hunter_outward_channels`, {
        method: 'PUT',
        data
    });
}

/**
 * 查询渠道发布中岗位信息
 * @param {*} params
 */
export function getChannelPost(recruitCode) {
    return request(`/api/recruitment/v1/channel_releases/${recruitCode}/recruit_outwards`);
}

/**
 * 更新渠道发布中岗位信息
 * @param {*} params
 */
export function updateChannelPost(outwardId, params) {
    return request(`/api/recruitment/v1/channel_releases/recruit_outwards/${outwardId}`, {
        method: 'PUT',
        data: params
    });
}
/**
 * 获取对外渠道字典
 * @param {*} params
 */
export function queryChannelDicts(channelSelectSearchList) {
    return request('/api/recruitment/v1/channel_releases/channel_selects/actions/batch_search', {
        method: 'POST',
        data: { channelSelectSearchList }
    });
}

/**
 * 获取面试列表
 * @param {object} params
 */
export async function queryInterviewList(params) {
    return request('/api/recruitment/v1/interviews/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 面试管理中获取列表
 * @param {object} params
 */
export async function queryInterviewAdminList(params) {
    return request('/api/recruitment/v1/interviews/manager/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 一键发布
 * @param {object} params
 */
export async function quickReleaseChannel(params) {
    return request('/api/recruitment/v1/channel_releases/actions/one_key_release', {
        method: 'POST',
        data: params
    });
}

/**
 * 一键更新
 * @param {object} params
 */
export async function quickUpdateChannel(params) {
    return request('/api/recruitment/v1/channel_releases/actions/one_key_update', {
        method: 'POST',
        data: params
    });
}

/**
 * 一键上线
 * @param {object} params
 */
export async function quickOnlineChannel(params) {
    return request('/api/recruitment/v1/channel_releases/actions/one_key_online', {
        method: 'POST',
        data: params
    });
}

/**
 * 一键下线
 * @param {object} params
 */
export async function quickOfflineChannel(params) {
    return request('/api/recruitment/v1/channel_releases/actions/one_key_offline', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取面试过程信息
 */
export async function getInterviewProcedure(arrangeId) {
    return request(`/api/recruitment/v1/interviews/procedure/${arrangeId}/interview_procedure`, {
        method: 'GET'
    });
}

/**
 * 保存面试主录音，追加上传使用
 * 必传 keyName, position
 * 2021.9.2  rec-1.0.1
 *
 */
export async function saveInterviewRecord(params) {
    return request('/api/recruitment/v1/interviews/procedure/actions/save_interview_record_url', {
        method: 'POST',
        data: params
    });
}

/**
 * 保存/更新面试准备问题
 * @param {*} params
 */
export function saveQuestion(params) {
    return request('/api/recruitment/v1/interviews/prepare/question/actions/save_question', {
        method: 'PUT',
        data: params
    });
}

/**
 * 删除面试准备问题
 * @param {*} params
 */
export async function deleteQuestion(questionId) {
    return request(`/api/recruitment/v1/interviews/prepare/question/${questionId}/actions/delete_question`, {
        method: 'PUT'
    });
}

/**
 * 保存/更新面试过程的答复
 * @param {*} params
 */
export function saveAnswer(params) {
    return request('/api/recruitment/v1/interviews/procedure/question/answer/actions/save', {
        method: 'PUT',
        data: params
    });
}

/**
 * 保存/更新面试过程的问题评论
 * @param {*} params
 */
export function saveComment(params) {
    return request('/api/recruitment/v1/interviews/procedure/question/comment/actions/save', {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取其他人问题信息
 */
export async function getOtherQuestions(arrangeId) {
    return request(`/api/recruitment/v1/interviews/procedure/${arrangeId}/question/list_other`, {
        method: 'GET'
    });
}

/**
 * 面试问题交换排序
 */
export async function changeQuestionsOrder(params) {
    return request('/api/recruitment/v1/interviews/prepare/question/actions/exchange_question_order_no', {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取面试当前面试录音状态
 */
// export async function getInterviewAudioRecordState(arrangeId) {
//     return request(`/api/oa/v1/work/recruitment/interviews/procedure/${arrangeId}/interview_voice_record_state`, {
//         method: 'GET'
//     });
// }
export async function getInterviewAudioRecordState(data) {
    return request(`/api/recruitment/v1/interviews/procedure/temp/interview_voice_record_state?${stringify(data)}`, {
        method: 'GET'
    });
}

/**
 * 更改面试过程的录音操作状态
 */
// export async function changeInterviewAudioRecordState(params) {
//     return request('/api/oa/v1/work/recruitment/interviews/procedure/actions/save_interview_voice_record_state', {
//         method: 'POST',
//         data: params
//     });
// }
export async function changeInterviewAudioRecordState(params) {
    return request('/api/recruitment/v1/interviews/procedure/actions/temp/save_interview_voice_record_state', {
        method: 'POST',
        data: params
    });
}

// 重置面试过程的录音操作状态-临时接口
export async function resetInterviewRecordState(arrangeId) {
    return request('/api/recruitment/v1/interviews/procedure/actions/temp/reset_interview_voice_record_state', {
        method: 'POST',
        data: { arrangeId, recordState: 2 }
    });
}

/**
 * 保存面试过程信息
 */
export async function onSaveInterviewprocedure(params) {
    return request('/api/recruitment/v1/interviews/procedure/actions/save_interview_procedure', {
        method: 'POST',
        data: params
    });
}

/**
 * 检测渠道账号状态
 * @param {object} params
 */
export async function checkChannelOnline(params) {
    return request('/api/recruitment/v1/channel_accounts/online_status', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取候选人人才简历信息详情
 * @param {*} params
 */
export function getTalentMessage(id) {
    return request(`/api/recruitment/v1/candidates/talent/${id}`, {
        method: 'GET'
    });
}
/**
 * 获取面试安排详情列表
 * @param {*} params
 */
export function getArranges(id) {
    return request(`/api/recruitment/v1/interviews/${id}/interview_arranges`, {
        method: 'GET'
    });
}

/**
 * 面试结论-创建群聊
 * @param {*} params
 */
export function createImGroup(params) {
    return request('/api/recruitment/v1/interviews/actions/create_im_group', {
        method: 'POST',
        data: params
    });
}

/**
 *获取面试准备信息
 * @param {*} params
 */
export function getInterviewPrepare(arrangeId) {
    return request(`/api/recruitment/v1/interviews/prepare/${arrangeId}/interview_prepare`, {
        method: 'GET'
    });
}
/**
 *获取面试结论信息
 * @param {*} params
 */
export function getConclusion(params) {
    return request(`/api/recruitment/v1/interviews/conclusion/interview_conclusion?${stringify(params)}`, {
        method: 'GET',
        data: params
    });
}

/**
 *面试准备信息提交
 * @param {*} params
 */
export function submitInterview(params) {
    return request('/api/recruitment/v1/interviews/prepare/actions/save_interview_prepare', {
        method: 'POST',
        data: params
    });
}
/**
 *面试记录提交前，判断所有面试官是否全部提交面试反馈
 * @arrangeId {*} arrangeId
 */
export function getConclusionSubmitStatus(arrangeId) {
    return request(`/api/recruitment/v1/interviews/conclusion/validate_records/${arrangeId}`, {
        method: 'GET'
    });
}
/**
 *面试记录提交
 * @param {*} params
 */
export function submitConclusion(params) {
    return request('/api/recruitment/v1/interviews/conclusion/actions/save_interview_conclusion', {
        method: 'POST',
        data: params
    });
}
/**
 *获取面试准备完成状态
 * @param {*} params
 */
export function getState(params) {
    return request('/api/recruitment/v1/interviews/prepare/state', {
        method: 'POST',
        data: params
    });
}

/**
 * 录用流程初始化数据?
 * @param {*} params
 */
export function workFlowHireAddData(params) {
    return request('/api/oa/workflow/recruitemploy/v1/addToHiData', {
        method: 'POST',
        data: params
    });
}
/**
 * 保存薪资沟通
 * @param {*} employId
 * @param {*} params
 */

export function saveHrCommunicate(employId, params) {
    return request(`/api/oa/v1/work/recruitment/communicate/actions/save_hr_communicate/${employId}`, {
        method: 'POST',
        data: params
    });
}

/**
 * 获取录用列表
 * @param {*} params
 */
export function getHireList(params) {
    return request('/api/recruitment/v1/employ/list', {
        method: 'POST',
        data: params
    });
}

/**
 * 终止录用
 * @param {*} employId
 * @param {*} params
 */

export function terminateHire(employId, params) {
    return request(`/api/oa/v1/work/recruitment/employ/termination/${employId}`, {
        method: 'POST',
        data: params
    });
}

/**
 * 查看沟通详情
 * @param {*} employId
 */
export function getCommunicateInfo(employId) {
    if (!employId) return Promise.resolve(); // 避免useRequest的bug...

    return request(`/api/recruitment/v1/communicate/actions/communicate_record/detail/${employId}`, {
        method: 'POST'
    });
}

/**
 * 查看沟通保存详情，不传employId就不会发起请求！！！
 * 这个接口，在有暂存数据的情况下，会返回暂存数据，无暂存数据的情况下，会返回正式保存的数据
 * @param {*} employId
 */
export function getCommunicateSaveInfo(employId) {
    if (!employId) return Promise.resolve(); // 避免useRequest的bug...

    return request(`/api/recruitment/v1/communicate/actions/communicate_record/detail/tmp/${employId}`, {
        method: 'POST'
    });
}

/**
 * 查看二次沟通和用人部门的沟通详情
 * @param {*} communicateCode
 */
export function getCommunicateExtraInfo(communicateCode) {
    if (!communicateCode) return Promise.resolve();

    return request(`/api/recruitment/v1/communicate/actions/communicate_record/${communicateCode}`, {
        method: 'POST'
    });
}

/**
 * 保存录用用人部门信息
 * @param {*} employId
 */
export function saveDepartCommunicate(communicateCode, params) {
    return request(`/api/oa/v1/work/recruitment/communicate/actions/save_department_communicate/${communicateCode}`, {
        method: 'POST',
        data: params
    });
}

/**
 * 获取对应权限岗位信息
 */
export function fetchPost() {
    return request('/api/uc/duty/v1/getListWithDataScope', {
        method: 'POST'
    });
}
/**
 * 有招聘需求的岗位信息
 */
export function fetchUsedPost(params = {}) {
    return request('/api/recruitment/v1/recruit_duty', {
        method: 'POST',
        data: params
    });
}

/**
 * 获取应聘岗位（有重复dutyCode）
 */

export function fetchPostExtra() {
    return request('/api/recruitment/v1/recruit/list', {
        method: 'GET'
    });
}

/**
 * 获取所有标签
 */
export function queryTagList() {
    return request('/api/recruitment/v1/tags/list_ext', {
        method: 'GET'
    });
}

/**
 * 修改面试作业
 */
export async function updateHomeWork(params) {
    return request('/api/recruitment/public/v1/interviews/homework/actions/update_homework', {
        method: 'PUT',
        data: params
    });
}

/**
 * 获取人才多招聘岗位信息
 * @param {*} talentCode 人才库-人才编码
 */
export async function queryTalentDuties(talentCode) {
    return request(`/api/recruitment/v1/resumes/${talentCode}/talent_duties`, {
        method: 'GET'
    });
}

/**
 * 查询下属员工或同组其他员工
 */
export function queryEmployee({ id }) {
    return request(`/api/recruitment/v1/${id}/org/list_subordinate_or_same_team`, {
        method: 'GET'
    });
}

// 1.8.3优化相关

// 获取未开始面试的接口
export function getUnStartInterviewer(arrangeId) {
    return request(`/api/recruitment/v1/interviews/procedure/${arrangeId}/no_start_interviewer`, {
        method: 'GET'
    });
}

// 同步当前用户访问页面状态
export function syncInterviewStatus(data) {
    return request('/api/recruitment/v1/interviews/procedure/actions/start_interview_record', {
        method: 'POST',
        data
    });
}

// 获取当前在录音的员工
export function getInterviewRecordStatus(arrangeId) {
    return request(`/api/recruitment/v1/interviews/procedure/${arrangeId}/start_interview_voice_operate_employee`, {
        method: 'GET'
    });
}

// 获取未提交面试过程的面试官
export function getUnSubmitInterviewProcedure(data) {
    return request('/api/recruitment/v1/interviews/conclusion/list/un_submit_interview_procedure', {
        method: 'POST',
        data
    });
}

// 设置面试官缺席
export function setInterviewAbsent(interviewerId) {
    return request(`/api/recruitment/v1/interviews/conclusion/actions/${interviewerId}/set_interview_absent`, {
        method: 'POST'
    });
}

// 取消面试官缺席
export function cancelInterviewAbsent(interviewerId) {
    return request(`/api/recruitment/v1/interviews/conclusion/actions/${interviewerId}/cancel_interview_absent`, {
        method: 'POST'
    });
}

// 通知面试官
export function notifyInterview(interviewerId) {
    return request(
        `/api/recruitment/v1/interviews/conclusion/actions/urge/${interviewerId}/urge_interviewer_feedback`,
        {
            method: 'POST'
        }
    );
}

// 获取当前面试官信息
export function getInterviewerDetail(data) {
    return request('/api/recruitment/v1/interviews/conclusion/interviewer/detail', {
        method: 'POST',
        data
    });
}

// 获取录用阶段的职位职级
export function getHirePositionAndRank(employId) {
    return request(`/api/recruitment/v1/employ/simple/${employId}`, {
        method: 'GET'
    });
}

// 是否需要查询发送邮件
/**
 *
 * @param {Object} data
 * @param {number} data.arrangeId
 * @param {number} data.resumeId
 * @returns {Object} result
 */
export function checkNeedSendMail(data) {
    return request('/api/recruitment/v1/candidates/need_send_email_flag', {
        method: 'POST',
        data
    });
}
